<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
include("../app/connection.php");
$subjectID = $_GET["subjectID"];
$semeterID=$_GET["semeterID"];
$yearID = $_GET["yearID"];
$query = "SELECT SINHVIEN.MSSV,HOTEN,DIEMTHUCHANH,DIEMGIUAKY,DIEMCUOIKY,DIEMTRUNGBINH from KETQUA,SINHVIEN where SINHVIEN.MSSV = KETQUA.MSSV and MAMONHOC = '$subjectID' and HOCKY = $semeterID and NAM ='$yearID'";
session_start();
//$s_user="GV007";
$s_user = $_SESSION["s_user"];
$time = date("h-m-s-d-m-Y");
$fileName = $s_user."-".$time;
require_once("Export.php");
if($_GET["filetype"]=="excel")
{

	$obj = new ExcelExport();
	$obj->writeByQuery($query);
	$obj->export("exported/$fileName".".xlsx");
	echo "exported/$fileName".".xlsx.php";
}
else
{
	$obj = new PDFExport();
	$obj->writeByQuery($query);
	$obj->export("exported/$fileName".".PDF");
	echo "exported/$fileName".".PDF.php";
}
?>
</body>
</html>